﻿using System;
using System.Net;
using ICU;

namespace VIP
{
    public class Main : CSharpPlugin
    {
        public override string Name { get => "VIP"; }
        public override string Desscription { get => "Make VIP user more powerful."; }
        public override string[] Author { get => new string[] { "Liyan Zhao(github.com/zly2006)" }; }
        public override Version Version { get => new Version(1, 0, 0); }
        public override string HomePage { get => "http://www.starlight.cool/api/icu/plugins/1"; }
        public override string UpdateUrl { get => "http://www.starlight.cool/api/icu/plugins/u/1"; }
        public override string[] Commands { get => new string[] { "vip" }; }

        public Main(IServer server, string path) : base(server, path)
        {
            UserLoginEvent += Main_UserLoginEvent;
            GetLogger().Info("Loading user data...");
        }

        private void Main_UserLoginEvent(object sender, UserLoginEventArgs e)
        {
            if (e.PasswordRight)
            {
                Server.SendSystemMessage(e.Id, Language.map[Language.Content.WelcomeVIP].Replace("%username%", Server.Users[e.Id].username));
            }
        }
    }
}
